package com.huluobo.h3kotlindemo.net

import com.huluobo.h3kotlindemo.cart.CartBeanResult
import com.huluobo.h3kotlindemo.category.CategoryBeanResult
import com.huluobo.h3kotlindemo.detail.ChangeCartBeanResult
import com.huluobo.h3kotlindemo.detail.DetailBeanResult
import com.huluobo.h3kotlindemo.home.HomeBannerBeanResult
import com.huluobo.h3kotlindemo.home.HomeListBeanResult
import com.huluobo.h3kotlindemo.login.UserBeanResult
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 *  Created by LC on 2023/11/2.
 */
interface ApiService {
    @POST(Const.URL_LOGIN)
    fun login(@Body body: RequestBody): Observable<UserBeanResult>

    @GET(Const.URL_GET_HOME_LIST)
    fun getHomeList(
        @Query(Const.PARAM_CATEGORY_ID) categoryId: Int,
        @Query(Const.PARAM_CURRENT_PAGE) currentPage: Int,
        @Query(Const.PARAM_PAGE_SIZE) pageSize: Int
    ): Observable<HomeListBeanResult>

    @GET(Const.URL_HOME_BANNER)
    fun getHomeBanner(): Observable<HomeBannerBeanResult>

    @GET(Const.URL_GET_GOODS_DETAIL)
    fun getGoodsDetail(@Query(Const.PARAM_GOODS_ID) goodsId: Int): Observable<DetailBeanResult>

    @POST(Const.URL_ADD_TO_CART)
    fun addToCart(@Body body: RequestBody): Observable<ChangeCartBeanResult>

    @GET(Const.URL_QUERY_CART)
    fun getCartList(): Observable<CartBeanResult>

    @POST(Const.URL_DELETE_CART)
    fun deleteCart(@Body body: RequestBody): Observable<ChangeCartBeanResult>

    @GET(Const.URL_CATEGORY)
    fun getCategoryParentChild(): Observable<CategoryBeanResult>
}